<template>
  <div class="userCode">
    <p>我的邀请二维码</p>
    <div class="qrcode">
      <img :src="img">
    </div>
    <div>
      <p class="url">{{url}}</p>
      <p class="tip">温馨提示：长按复制粘贴地址或者截屏扫码分享</p>
    </div>
  </div>
</template>
<script type="text/ecmascript-6">
export default {
  created () {
    this.$http.post('http://218.104.153.143:8089/numberone-auth/busiUser/getQrImage.shtml', {token: this.$store.state.token}, { // 头文件及JSON格式设定
      headers: {'Content-Type': 'application/x-www-form-urlencoded'},
      emulateJSON: true
    }).then((data) => { // 数据获取成功
      this.img = 'http://218.104.153.143:8089/numberone-auth' + data.body.path
      this.url = data.body.link
    }, (ne) => { // 数据获取失败
      this.$message({
        message: '网络异常',
        type: 'error',
        duration: 1000,
        showClose: false
      })
    })
  },
  data () {
    return {
      img: '',
      url: ''
    }
  }
}
</script>
<style lang="scss" type="stylesheet/scss">
.userCode{
.qrcode {
  width:200px;
  height:200px;
  margin:20px auto;
  img{
    width:100%;
    height:100%;
  }
}
p{
    line-height:50px;
    word-wrap:break-word;
  }
  .tip{
    font-size:12px;
    color:#757575;
    line-height:20px;
  }
  .url{
    line-height:20px;
    width:80%;
    font-size:14px;
    margin:20px auto;
    text-align:left;
  }
}


</style>
